﻿@model VIT.Pre.HealthCare.Models.CptModel

@{
    ViewBag.Title = "Phòng khám online";
    Layout = "~/Views/Shared/_MainLayout.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset class="patientinfo">
        <legend>Thông tin điều trị</legend>
        <table>
            <tr>
                <td class="title">
                    @Html.LabelFor(model => model.Id):
                    @Html.HiddenFor(model => model.Id, new { @Value = Model.Id })
                </td>
                <td class="value">
                    <div class="id">@Html.DisplayFor(model => model.Id)</div>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td class="title">
                    @Html.LabelFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </td>
                <td class="value">@Html.EditorFor(model => model.Name)</td>
            </tr>
        </table>
        <table>
            <tr>
                <td class="title">
                    @Html.LabelFor(model => model.Description)
                    @Html.ValidationMessageFor(model => model.Description)
                </td>
                <td class="value">@Html.EditorFor(model => model.Description)</td>
            </tr>
        </table>
        
        <table>
            <tr>
                <td class="title">
                    @Html.LabelFor(model => model.Fee)
                    @Html.ValidationMessageFor(model => model.Fee)
                </td>
                <td class="value">@Html.EditorFor(model => model.Fee)</td>
            </tr>
        </table>

        <table>
            <tr>
                <td class="title">
                    @Html.LabelFor(model => model.Stock):
                </td>
                <td class="value">@Html.EditorFor(model => model.Stock)</td>
            </tr>
        </table>
        
        <table>
            <tr>
                <td class="title">
                    @Html.LabelFor(model => model.Active):
                </td>
                <td class="value check">@Html.CheckBoxFor(model => model.Active)</td>
            </tr>
        </table>

        <input type="submit" value="Lưu" class="btnLogin save" style="float:left; padding-left: 15px"/>
        
        @{ var display = Model.Id > 0 ? "" : "none"; }
        <input type="button" value="Thêm mới" onclick="window.location.href = '/Settings/Cpt';" class="btnLogin save" style="float:left; padding-left: 15px; display:@display"/>
    </fieldset>
}

<fieldset class="patientlist">
    <legend>Danh sách điều trị</legend>
    <form action="/Settings/Cpt" method="GET">
        <table width="100%">
            <tr>
                <td><input id='search' name="skey" type="text" style="width: 100%;height: 19px;"/> </td>
                <td style="padding-left:10px" class="btnSearch"><input name="" type="submit" value="Tìm"/></td>                  
            </tr>
        </table>
    </form>
    <table class="table" width="100%" border="0" cellspacing="0" cellpadding="0">
        <thead>
            <tr>
                <td>Tên</td>
                <td>Mô tả</td>
                <td>Phí</td>
                <td>Tồn kho</td>
                <td style="width: 52px">Sử dụng</td>
                <td style="width: 25px">Xóa</td>
            </tr>
        </thead>
        
        @foreach (var o in Model.Cpts)
        {
            var active = o.Active ? "Y" : "N";
            <tr onclick="window.location.assign('/Settings/Cpt?id=@o.Id&skey=@Request["skey"]')">
                <td>@o.Name</td>
                <td>@o.Description</td>
                <td>@o.Fee</td>
                <td>@o.Stock</td>
                <td style="text-align: center">@active</td>
                <td style="text-align: center"><a href="/Settings/CptDelete?id=@o.Id"><img src="../../Content/images/DeleteRed.png"/></a></td>
            </tr>
        }
    </table>
 </fieldset>

